﻿using UnityEngine;

public class GuiDisplay : MonoBehaviour 
{	
	public Texture texture;
		
	private string textDisplay = "Ball Of Colour";	
	private string successMsg = "Success";	
	private string failMsg = "Fail";
	
#if UNITY_ANDROID
	private string finishMsgAndroid = "Tap two fingers to continue";
#else
	private string finishMsgPC = "Press Space bar to continue";	
#endif
	
	private GameState gameState;
	
	void Start()
	{
		gameState = (GameState) GetComponent("GameState");
	}
	
    void OnGUI() 
	{
		// Color Venn
        if (!texture) 
		{
            Debug.LogError("Assign a Texture in the inspector.");
            return;
        }
        GUI.DrawTexture(new Rect(10, 10, 120, 120), texture, ScaleMode.ScaleToFit, true, 1.0f);
		
		string message = textDisplay;
		
		if (gameState.gameState == GameState.State.SUCCESS)
		{
			message += "\n" + successMsg;
			
#if UNITY_ANDROID
			message += "\n" + finishMsgAndroid;
#else
			message += "\n" + finishMsgPC;
#endif			
		}
		else if (gameState.gameState == GameState.State.FAIL)
		{
			message += "\n" + failMsg;
			
#if UNITY_ANDROID
			message += "\n" + finishMsgAndroid;
#else
			message += "\n" + finishMsgPC;
#endif
		}
		
		GUIStyle style = new GUIStyle();
		style.fontSize = 20;
		
		GUI.TextArea(new Rect(10, 130, 120, 40), message, style);
    }
}